<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="icon" href={{ url_for('static', filename='images/icon.png') }} type="image/x-icon">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Open Subway API</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            line-height: 1.6;
            margin: 20px;
            background-color: #f9f9f9;
            color: #333;
        }
        .container {
            max-width: 800px;
            margin: 0 auto;
            padding: 20px;
            background-color: #fff;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
        h1, h2, h3 {
            color: #333;
            margin-top: 20px;
        }
        h1 {
            text-align: center;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin: 20px 0;
            border: 1px solid #ddd;
        }
        th, td {
            padding: 12px;
            border: 1px solid #ddd;
            text-align: left;
        }
        th {
            background-color: #f4f4f4;
            font-weight: bold;
        }
        code {
            background-color: #f9f9f9;
            padding: 2px 4px;
            border: 1px solid #ddd;
            border-radius: 4px;
            display: inline-block;
        }
        pre {
            background-color: #f9f9f9;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 4px;
            overflow-x: auto;
        }
        ul {
            margin: 20px 0;
        }
        li {
            margin: 5px 0;
        }
        a {
            color: #007BFF;
            text-decoration: none;
        }
        a:hover {
            text-decoration: underline;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>Open Subway API说明书</h1>

        <h2>1. 接口地址</h2>
        <p><code>{{ address }}/api/get/way</code></p>

        <h2>2. 请求方式</h2>
        <p>GET</p>

        <h2>3. 请求参数</h2>
        <table>
            <thead>
                <tr>
                    <th>参数名</th>
                    <th>类型</th>
                    <th>是否必填</th>
                    <th>示例值</th>
                    <th>描述</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>start</td>
                    <td>string</td>
                    <td>是</td>
                    <td>古城</td>
                    <td>出发站点名称</td>
                </tr>
                <tr>
                    <td>end</td>
                    <td>string</td>
                    <td>是</td>
                    <td>苹果园</td>
                    <td>目的站点名称</td>
                </tr>
            </tbody>
        </table>

        <h2>4. 返回数据格式</h2>
        <p>返回数据为JSON格式，示例如下：</p>
        <pre><code>{
    "message": "succeed",
    "plans": [
        {
            "end_station_name": "苹果园",
            "end_time": 73519,
            "lines": [
                "1号线八通线",
                "2号线",
                "6号线"
            ],
            "now_time": 70000,
            "start_station_name": "古城",
            "start_time": 70020,
            "trans_stations": [
                "复兴门",
                "车公庄"
            ],
            "whole_time": 3519
        },
        {
            "end_station_name": "苹果园",
            "end_time": 73519,
            "lines": [
                "1号线八通线",
                "2号线",
                "6号线",
                "S1线"
            ],
            "now_time": 70000,
            "start_station_name": "古城",
            "start_time": 70020,
            "trans_stations": [
                "复兴门",
                "车公庄"
            ],
            "whole_time": 3519
        }
    ]
}</code></pre>

        <h2>5. 返回参数说明</h2>
        <table>
            <thead>
                <tr>
                    <th>参数名</th>
                    <th>类型</th>
                    <th>描述</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>message</td>
                    <td>string</td>
                    <td>请求结果状态，"succeed"表示成功</td>
                </tr>
                <tr>
                    <td>plans</td>
                    <td>array</td>
                    <td>出行规划方案列表</td>
                </tr>
                <tr>
                    <td>plans[].end_station_name</td>
                    <td>string</td>
                    <td>目的站点名称</td>
                </tr>
                <tr>
                    <td>plans[].end_time</td>
                    <td>int</td>
                    <td>到达目的站点的时间（时间戳）</td>
                </tr>
                <tr>
                    <td>plans[].lines</td>
                    <td>array</td>
                    <td>涉及的地铁线路列表</td>
                </tr>
                <tr>
                    <td>plans[].now_time</td>
                    <td>int</td>
                    <td>当前时间（时间戳）</td>
                </tr>
                <tr>
                    <td>plans[].start_station_name</td>
                    <td>string</td>
                    <td>出发站点名称</td>
                </tr>
                <tr>
                    <td>plans[].start_time</td>
                    <td>int</td>
                    <td>出发时间（时间戳）</td>
                </tr>
                <tr>
                    <td>plans[].trans_stations</td>
                    <td>array</td>
                    <td>换乘站点列表</td>
                </tr>
                <tr>
                    <td>plans[].whole_time</td>
                    <td>int</td>
                    <td>整个行程的耗时</td>
                </tr>
            </tbody>
        </table>

        <h2>6. 示例</h2>
        <h3>请求示例</h3>
        <p><code>{{ address }}/api/get?start=古城&end=苹果园</code></p>

        <h3>返回示例</h3>
        <pre><code>{
    "message": "succeed",
    "plans": [
        {
            "end_station_name": "苹果园",
            "end_time": 73519,
            "lines": [
                "1号线八通线",
                "2号线",
                "6号线"
            ],
            "now_time": 70000,
            "start_station_name": "古城",
            "start_time": 70020,
            "trans_stations": [
                "复兴门",
                "车公庄"
            ],
            "whole_time": 3519
        },
        {
            "end_station_name": "苹果园",
            "end_time": 73519,
            "lines": [
                "1号线八通线",
                "2号线",
                "6号线",
                "S1线"
            ],
            "now_time": 70000,
            "start_station_name": "古城",
            "start_time": 70020,
            "trans_stations": [
                "复兴门",
                "车公庄"
            ],
            "whole_time": 3519
        }
    ]
}</code></pre>

        <h2>7. 注意事项</h2>
        <ul>
            <li>请求参数中的站点名称需要准确无误，否则可能导致查询失败。</li>
            <li>返回的时间戳需要根据实际需求进行格式化处理。</li>
            <li>如果返回的<code>message</code>不是"succeed"，请根据具体返回值进行错误处理。</li>
        </ul>
    </div>
</body>
</html>